package com.baiyapeng.code.web;

import com.alibaba.dubbo.config.annotation.Reference;
import com.baiyapeng.code.service.OrderService;
import com.baiyapeng.code.web.response.ResponseResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * <b>订单接口</b><br/>
 *
 * @author baiyapeng
 * @since 1.0.0
 */
@RestController
@Slf4j
public class OrderController {

    @Reference
    private OrderService orderService;

    /**
     * <p>查询全部订单</p>
     *
     * @param username 用户名<<必填>>
     * @return
     */
    @RequestMapping("/getAllOrder")
    public ResponseResult getAllOrder(@RequestParam("username") String username) {
        log.debug("--------> web层正在查询：{} <---------", username);
        ResponseResult result = new ResponseResult();
        result.setData(orderService.findAllOrder(username));
        return result;
    }
}
